package com.webchat.ugc.repository.entity.mall;

import com.webchat.ugc.repository.entity.BaseEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 商品订单（用户在业务下单购买订单）
 */
@Data
@Entity
@Table(name = "web_chat_mall_product_order")
public class MallProductOrderEntity extends BaseEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    protected Long id;

    /**
     * 订单业务ID
     */
    @Column(name = "order_no")
    protected String orderNo;

    /**
     * 分布式交易事务ID
     */
    @Column(name = "trans_id")
    protected String transId;

    /**
     * 绑定交易订单id
     */
    @Column(name = "payment_order_id")
    protected String paymentOrderId;

    @Column(name = "user_id")
    private String userId;

    @Column(name = "spu_id")
    private Long spuId;

    @Column(name = "sku_id")
    private Long skuId;

    /**
     * 支付状态
     */
    @Column(name = "payment_status")
    private Integer paymentStatus;

    /**
     * 物流状态
     */
    @Column(name = "logistics_status")
    private Integer logisticsStatus;

    /**
     * 收货地
     */
    @Column(name = "express_id")
    private Long expressId;

    /**
     * 购买数量
     */
    @Column(name = "product_count")
    private Integer productCount;

    /**
     * 支付方式
     */
    @Column(name = "payment_type")
    private Integer paymentType;

    /**
     * 购买那一刻单价
     */
    @Column(name = "price")
    private BigDecimal price;

    /**
     * 实付价格
     */
    @Column(name = "payment_price")
    private BigDecimal paymentPrice;

    /**
     * 应付价格
     */
    @Column(name = "payable_price")
    private BigDecimal payablePrice;

    /**
     * 优惠券抵扣
     */
    @Column(name = "coupon_id")
    private Long couponId;

    /**
     * 优惠券抵扣金额
     */
    @Column(name = "coupon_price")
    private BigDecimal couponPrice;

    /**
     * 支付截止时间
     */
    @Column(name = "payment_timeout")
    private Date paymentTimeout;

    /**
     * 实际支付时间
     */
    @Column(name = "payment_date")
    private Date paymentDate;
}
